#pragma once

const UINT  POINTTYPE_NONE   = 0;
const UINT  POINTTYPE_LEFT   = 1;
const UINT  POINTTYPE_RIGHT  = 2;
const UINT  POINT_MAX        = 29;

class CLadderLine
{
public:
    CLadderLine(void);
    ~CLadderLine(void);

public:
    void      RemovePoint     (const CPoint& ptLadder);
    void      RemovePoint     (const UINT& nIndex);
    BOOL      AddLadderPoint  (CPoint& ptLadder);
    BOOL      AddLadderPoint  (const UINT& nType, UINT& nIndex);
    void      SetLadderInfo   (const UINT& nIndex, LPCTSTR strUserName, 
                               LPCTSTR strItemName);
    void      GetLadderInfo   (CString& strUserName, CString& strItemName);
    CPtArray& GetTotalPoint   () { return m_aptLadder; };
    void      GetLeftPoints   (CUIntArray& anIndex);
    void      GetRightPoints  (CUIntArray& anIndex);
    void      GetTotalPoint   (CUIntArray& anIndex);
    void      ResetLadder     ();
    CPoint    GetNextPoint    (const int& nPosY);
    UINT      GetNextIndex    (const int& nIndex);
    void      SetLineColor    (const Color& clrLine) { m_clrLine = clrLine; };
    Color     GetLineColor    () { return m_clrLine; };
    BOOL      GetAddRange     (int& nLow, int& nHigh);
    BOOL      GetAddIndexRange(int& nLow, int& nHigh);
    UINT      GetPointType    (const UINT& nIndex) { return m_anLadderPoint[nIndex]; };
    void      SortIndex       ();
    void      ReorderingPoints(const BOOL& bReordering = TRUE);
    BOOL      CheckDuplication(const UINT& nLow, const UINT& nHigh);
    void      SetResult       (const int& nIndex) { m_nResult = nIndex; };
    int       GetResult       () { return m_nResult;};
    void      SetUserInfo     (const USER_INFO& userInfo);

private:
    CString  m_strUserName;
    CString  m_strItemName;
    UINT     m_nLineIndex;
    CPtArray m_aptLadder;
    Color    m_clrLine;
    UINT     m_anLadderPoint[50];
    int      m_nResult;
    USER_INFO  m_userInfo;
    CUIntArray m_anLeftPoints;
    CUIntArray m_anRightPoints;
    CUIntArray m_anTotalPoint;
};

